package com.hyc.myvideo.data.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.hyc.myvideo.data.api.model.ModelLiveType;
import com.hyc.myvideo.ui.base.BaseFragment;

import java.util.List;


/**
 * 导航适配器
 * @author gyb
 * @version 1.0
 * @created 2017/07/21
 */
public class MyPagerAdapter extends FragmentPagerAdapter {
    private List<ModelLiveType> mTitles;
    private Context context;
    private List<BaseFragment> fragments;
    public MyPagerAdapter(List<BaseFragment> fragments, List<ModelLiveType>  titles, FragmentManager fm, Context context) {
        super(fm);
        this.context = context;
        this.fragments = fragments;
        this.mTitles = titles;
    }
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }
    @Override
    public int getCount() {
        return mTitles.size();
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position).getTypesName();
    }
}
